<template>
  <view class="pay-detail-page">
    <!-- 顶部导航栏 -->

    <!-- 支付状态区域 -->
    <view class="pay-status">
      <view class="status-icon success">
        <text class="iconfont icon-success"></text>
      </view>
      <view class="status-text">支付成功</view>
      <view class="pay-time">2023-09-15 14:30:45</view>
    </view>

    <!-- 金额信息 -->
    <view class="amount-section">
      <view class="amount-label">支付金额</view>
      <view class="amount-value">
        <text class="currency-symbol">¥</text>
        <text class="amount">198.00</text>
      </view>
    </view>

    <!-- 订单信息卡片 -->
    <view class="order-card">
      <view class="card-title">订单信息</view>

      <view class="order-info-item">
        <view class="info-label">订单编号</view>
        <view class="info-value">202309151428356789</view>
      </view>

      <view class="order-info-item">
        <view class="info-label">商户名称</view>
        <view class="info-value">康泰养老服务中心</view>
      </view>

      <view class="order-info-item">
        <view class="info-label">支付方式</view>
        <view class="info-value">
          <text class="iconfont icon-wechat-pay"></text>
          <text>微信支付</text>
        </view>
      </view>

      <view class="order-info-item">
        <view class="info-label">交易单号</view>
        <view class="info-value">4200001928202309158576345210</view>
      </view>

      <view class="order-info-item">
        <view class="info-label">商品说明</view>
        <view class="info-value">月度护理服务套餐</view>
      </view>
    </view>

    <!-- 金额明细 -->
    <view class="amount-detail">
      <view class="detail-title">金额明细</view>

      <view class="detail-item">
        <view class="detail-label">商品金额</view>
        <view class="detail-value">¥238.00</view>
      </view>

      <view class="detail-item">
        <view class="detail-label">优惠折扣</view>
        <view class="detail-value">-¥40.00</view>
      </view>

      <view class="detail-item total">
        <view class="detail-label">实付金额</view>
        <view class="detail-value">¥198.00</view>
      </view>
    </view>

    <!-- 操作按钮 -->
    <view class="action-buttons">
      <button class="btn btn-share" @click="onShare">
        分享账单
      </button>
      <button class="btn btn-download" @click="onDownload">
        下载凭证
      </button>
    </view>

    <!-- 底部提示 -->
    <view class="footer-tip">
      <text>如有疑问，请联系商家客服</text>
    </view>
  </view>
</template>

<script setup>
// 返回上一页
const onBack = () => {
  uni.navigateBack({
    delta: 1
  });
};

// 分享账单
const onShare = () => {
  uni.showToast({
    title: '已唤起分享',
    icon: 'none'
  });
};

// 下载凭证
const onDownload = () => {
  uni.showToast({
    title: '凭证已保存到相册',
    icon: 'none'
  });
};
</script>

<style lang="less" scoped>
// 变量定义
@primary-color: #07c160; // 微信支付绿色
@text-primary: #333333;
@text-secondary: #666666;
@text-tertiary: #999999;
@border-color: #eeeeee;
@card-bg: #ffffff;
@page-bg: #f5f5f5;
@btn-share: #f5f5f5;
@btn-share-text: #666666;

.pay-detail-page {
  background-color: @page-bg;
  min-height: 100vh;
  padding-bottom: 30rpx;
}

// 导航栏
.navbar {
  display: flex;
  align-items: center;
  height: 100rpx;
  padding: 0 30rpx;
  background-color: #ffffff;
  border-bottom: 1px solid @border-color;

  .back-btn {
    width: 60rpx;
    height: 100rpx;
    display: flex;
    align-items: center;

    .icon-back {
      font-size: 36rpx;
      color: @text-primary;
    }
  }

  .navbar-title {
    flex: 1;
    text-align: center;
    font-size: 34rpx;
    font-weight: 500;
    color: @text-primary;
  }
}

// 支付状态
.pay-status {
  background-color: @card-bg;
  padding: 60rpx 0 40rpx;
  text-align: center;
  margin-bottom: 20rpx;

  .status-icon {
    width: 120rpx;
    height: 120rpx;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20rpx;

    &.success {
      background-color: rgba(7, 193, 96, 0.1);

      .icon-success {
        font-size: 70rpx;
        color: @primary-color;
      }
    }
  }

  .status-text {
    font-size: 36rpx;
    font-weight: 500;
    color: @text-primary;
    margin-bottom: 10rpx;
  }

  .pay-time {
    font-size: 26rpx;
    color: @text-tertiary;
  }
}

// 金额信息
.amount-section {
  background-color: @card-bg;
  padding: 40rpx 30rpx;
  text-align: center;
  margin-bottom: 20rpx;

  .amount-label {
    font-size: 28rpx;
    color: @text-secondary;
    margin-bottom: 15rpx;
  }

  .amount-value {
    .currency-symbol {
      font-size: 36rpx;
      color: @text-primary;
      margin-right: 10rpx;
    }

    .amount {
      font-size: 60rpx;
      font-weight: 600;
      color: @text-primary;
    }
  }
}

// 订单信息卡片
.order-card {
  background-color: @card-bg;
  margin-bottom: 20rpx;
  padding: 0 30rpx;

  .card-title {
    font-size: 30rpx;
    color: @text-primary;
    padding: 30rpx 0;
    border-bottom: 1px solid @border-color;
  }

  .order-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26rpx 0;
    border-bottom: 1px solid @border-color;

    &:last-child {
      border-bottom: none;
    }

    .info-label {
      font-size: 28rpx;
      color: @text-secondary;
    }

    .info-value {
      font-size: 28rpx;
      color: @text-primary;
      text-align: right;
      display: flex;
      align-items: center;

      .icon-wechat-pay {
        color: @primary-color;
        font-size: 30rpx;
        margin-right: 8rpx;
      }
    }
  }
}

// 金额明细
.amount-detail {
  background-color: @card-bg;
  margin-bottom: 40rpx;
  padding: 0 30rpx;

  .detail-title {
    font-size: 30rpx;
    color: @text-primary;
    padding: 30rpx 0;
    border-bottom: 1px solid @border-color;
  }

  .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 26rpx 0;
    border-bottom: 1px solid @border-color;

    &:last-child {
      border-bottom: none;
    }

    .detail-label {
      font-size: 28rpx;
      color: @text-secondary;
    }

    .detail-value {
      font-size: 28rpx;
      color: @text-primary;
    }

    &.total {
      .detail-label {
        font-weight: 500;
        color: @text-primary;
      }

      .detail-value {
        font-weight: 500;
        color: @text-primary;
      }
    }
  }
}

// 操作按钮
.action-buttons {
  display: flex;
  padding: 0 30rpx;
  gap: 20rpx;
  margin-bottom: 40rpx;

  .btn {
    flex: 1;
    height: 90rpx;
    //border-radius: 45rpx;
    font-size: 30rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;

    .iconfont {
      margin-right: 10rpx;
      font-size: 32rpx;
    }
  }

  .btn-share {
    background-color: @btn-share;
    color: @btn-share-text;
  }

  .btn-download {
    background-color: @primary-color;
    color: #ffffff;
  }
}

// 底部提示
.footer-tip {
  text-align: center;
  font-size: 26rpx;
  color: @text-tertiary;
  padding: 0 30rpx;
}
</style>
